<template>
  <div class="side">
    <div class="side-head">超稠油蒸汽处理器液位</div>
    <div class="side-choose"></div>
    <div class="side-echarts1"></div>
    <div class="side-table1">
      <table>
        <tr class="title">
          <th>数据源</th>
          <th>液位</th>
          <th>时间</th>
        </tr>
        <tr class="item">
          <td class="item-td">调储罐</td>
          <td class="item-td">15.1</td>
          <td class="item-td">14：10</td>
        </tr>
        <tr class="item">
          <td class="item-td">反应提升泵</td>
          <td class="item-td">15.1</td>
          <td class="item-td">14：10</td>
        </tr>
        <tr class="item">
          <td class="item-td">反应器</td>
          <td class="item-td">15.1</td>
          <td class="item-td">14：10</td>
        </tr>
      </table>
    </div>
  </div>
</template>
  
<script>
export default {
  mounted() {
    this.initEcharts();
  },
  data() {
    return {
      // 配置项
      option1: {
        // 标头
        legend: {
          data: ["蒸汽处理器A", "蒸汽处理器B"],
          textStyle: {
            fontSize: 12,
            color: "white",
          },
        },
        // 网格线位置
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        // 保存为图片
        toolbox: {
          feature: {
            saveAsImage: {},
          },
        },
        // 拐点颜色
        itemStyle: {
          borderColor: "#E9CD4B",
        },
        // 字体颜色
        textStyle: {
          color: "#ff9d16",
        },
        xAxis: {
          type: "category",
          data: ["13:00", "13:10", "13:20", "13:30", "13:40", "13:50", "14:00"],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: [1.2, 1.3, 2.2, 2.4, 3.4, 4.3, 5.6],
            type: "line",
            name: "蒸汽处理器A",
            // 显示数值
            itemStyle: { normal: { label: { show: true } } },
            // 线条颜色
            lineStyle: {
              width: 3,
              color: "#ff9d16",
            },
          },
          {
            data: [2.1, 2.3, 3.1, 4.1, 4.2, 5.1, 6.2],
            type: "line",
            name: "蒸汽处理器B",
            // 显示数值
            itemStyle: { normal: { label: { show: true } } },
            // 线条颜色
            lineStyle: {
              width: 3,
              color: "#ff9d16",
            },
          },
        ],
      },
    };
  },

  methods: {
    // 初始化表格
    initEcharts() {
      var myChart = this.$echarts.init(
        document.querySelector(".side-echarts1")
      );
      // console.log(myChart);
      myChart.setOption(this.option1);
      window.addEventListener("resize", function () {
        myChart.resize();
      });
    },
  },
};
</script>
  
  <style scoped>
/* 头部 */
.side-head {
  height: 50px;
  background-image: url(../../../assets/img/tankLevel1.svg);
  background-size: cover;
  background-position: 50% 50%;
  background-repeat: no-repeat;

  padding-left: 10px;

  color: rgba(117, 249, 253, 1);
  font-size: 20px;
  font-family: Arial;
  font-weight: 700;
  line-height: 50px;
}
/* 图表 */
.side-echarts1 {
  width: 100%;
  height: 400px;
  /* background-color: pink; */

  margin-top: 20px;
  margin-bottom: 20px;
}
/* 表格 */
.side-table1{
  margin: 10px;
}
table {
  border-collapse: collapse;
  border-spacing: 0px;
  font-size:12px;
}

table,
th,
td {
  border: 1px solid black;
}

td{
  color: #1092cb;
}

th {
  width: 100vw;

  color: white;
}

.title {
  height: 40px;
  background-color: skyblue;
}

.item {
  height: 40px;
  background-color: yellowgreen;

  text-align: center;
  color: red;
}

/* 偶数行 */
tr:nth-child(2n) {
  background-color: #125a69;
}
/* 奇数行 */
tr:nth-child(2n + 1) {
  background-color: #0e425b;
}

td:first-child{
  color: #adbc24;
}
</style>